﻿using Microsoft.Practices.Unity.InterceptionExtension;
using WDA.Core;

namespace Sample
{
	public class LoggingInterceptor : ICallHandler
	{
		private static Logger _log = new Logger("Sample.ConverterService");
		
      #region ICallHandler Members
      public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
      {
         Logger.Write(input.MethodBase.DeclaringType.FullName, "About to call method {0}.", null, System.Diagnostics.TraceEventType.Information, null, input.MethodBase.Name);
         IMethodReturn result = getNext()(input, getNext);
         Logger.Write(input.MethodBase.DeclaringType.FullName, "Method {0} returned.", null, System.Diagnostics.TraceEventType.Information, null, input.MethodBase.Name);
         return result;
      }
      public int Order { get; set;}      
      #endregion
   }
}
